package com.wande.dataplatform.common.exception;

import com.wande.dataplatform.common.enums.DataPlatformErrorCode;
import lombok.Getter;

/**
 * 数据中台业务异常
 * 
 * @author ruoyi
 */
@Getter
public class DataPlatformException extends RuntimeException {

    private final int code;
    private final String message;

    public DataPlatformException(DataPlatformErrorCode errorCode) {
        super(errorCode.getMessage());
        this.code = errorCode.getCode();
        this.message = errorCode.getMessage();
    }

    public DataPlatformException(DataPlatformErrorCode errorCode, Throwable cause) {
        super(errorCode.getMessage(), cause);
        this.code = errorCode.getCode();
        this.message = errorCode.getMessage();
    }

    public DataPlatformException(DataPlatformErrorCode errorCode, String customMessage) {
        super(customMessage);
        this.code = errorCode.getCode();
        this.message = customMessage;
    }

    public DataPlatformException(int code, String message) {
        super(message);
        this.code = code;
        this.message = message;
    }

}
